package cn.tedu.emp.controller;

import cn.tedu.emp.mapper.EmployeeMapper;
import cn.tedu.emp.pojo.Employee;
import cn.tedu.emp.pojo.EmployeeExample;
import cn.tedu.emp.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.parsing.EmptyReaderEventListener;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

@Controller
@RequestMapping
public class employeeController {
    @Autowired
    private EmployeeService employeeService;
    @RequestMapping("/findAll")
    @CrossOrigin
    @ResponseBody
    public List<Employee> selectAll(){
        return employeeService.selectAll();
    }

    @RequestMapping("/findEmployeeList")
    public String findEmployeeList() {
        return "emplist";
    }
    @RequestMapping("/download1")
    @ResponseBody
    public void  download(HttpServletRequest request, HttpServletResponse response){
        employeeService.download(request, response);
    }
}
